package com.wuotng.xsxx.xjxx.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wuotng.common.annotation.Log;
import com.wuotng.common.core.controller.BaseController;
import com.wuotng.common.core.domain.AjaxResult;
import com.wuotng.common.enums.BusinessType;
import com.wuotng.xsxx.xjxx.domain.XsxxXjxx;
import com.wuotng.xsxx.xjxx.service.IXsxxXjxxService;
import com.wuotng.common.utils.poi.ExcelUtil;
import com.wuotng.common.core.page.TableDataInfo;

/**
 * 学籍信息Controller
 * 
 * @author ruoyi
 * @date 2025-05-14
 */
@RestController
@RequestMapping("/xsxx/xjxx")
public class XsxxXjxxController extends BaseController
{
    @Autowired
    private IXsxxXjxxService xsxxXjxxService;

    /**
     * 查询学籍信息列表
     */
    @PreAuthorize("@ss.hasPermi('xsxx:xjxx:list')")
    @GetMapping("/list")
    public TableDataInfo list(XsxxXjxx xsxxXjxx)
    {
        startPage();
        List<XsxxXjxx> list = xsxxXjxxService.selectXsxxXjxxList(xsxxXjxx);
        return getDataTable(list);
    }

    /**
     * 导出学籍信息列表
     */
    @PreAuthorize("@ss.hasPermi('xsxx:xjxx:export')")
    @Log(title = "学籍信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, XsxxXjxx xsxxXjxx)
    {
        List<XsxxXjxx> list = xsxxXjxxService.selectXsxxXjxxList(xsxxXjxx);
        ExcelUtil<XsxxXjxx> util = new ExcelUtil<XsxxXjxx>(XsxxXjxx.class);
        util.exportExcel(response, list, "学籍信息数据");
    }

    /**
     * 获取学籍信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('xsxx:xjxx:query')")
    @GetMapping(value = "/{xjxxId}")
    public AjaxResult getInfo(@PathVariable("xjxxId") String xjxxId)
    {
        return success(xsxxXjxxService.selectXsxxXjxxByXjxxId(xjxxId));
    }

    /**
     * 新增学籍信息
     */
    @PreAuthorize("@ss.hasPermi('xsxx:xjxx:add')")
    @Log(title = "学籍信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody XsxxXjxx xsxxXjxx)
    {
        return toAjax(xsxxXjxxService.insertXsxxXjxx(xsxxXjxx));
    }

    /**
     * 修改学籍信息
     */
    @PreAuthorize("@ss.hasPermi('xsxx:xjxx:edit')")
    @Log(title = "学籍信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody XsxxXjxx xsxxXjxx)
    {
        return toAjax(xsxxXjxxService.updateXsxxXjxx(xsxxXjxx));
    }

    /**
     * 删除学籍信息
     */
    @PreAuthorize("@ss.hasPermi('xsxx:xjxx:remove')")
    @Log(title = "学籍信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{xjxxIds}")
    public AjaxResult remove(@PathVariable String[] xjxxIds)
    {
        return toAjax(xsxxXjxxService.deleteXsxxXjxxByXjxxIds(xjxxIds));
    }
}
